import request from '@/request'

export function getAdminList(query) {
  return request({
    url: '/admin/adminList',
    method: 'post',
    data: {
      pageNo: query.pageNo,
      pageSize: query.pageSize,
      account: query.queryAccount,
      password: query.password,
      id: query.id,
    },
  })
}

export function addAdmin(query) {
  return request({
    url: '/admin/addAdmin',
    method: 'post',
    data :{
/*      id: query.id,*/
      account: query.queryAccount,
      password: query.password,
    }
  })
}

export function updateAdminById(query) {
  return request({
    url: '/admin/updateAdmin',
    method: 'post',
    data: {
      id: query.id,
      account: query.account,
      password: query.password,
    }
  })
}
export function resetPwd(query) {
  return request({
    url: '/admin/resetPwd',
    method: 'post',
    data: {
      id: query.id,
      account: query.account,
      password: query.password,
    }
  })
}

export function bannedAccount(admin,token) {
  return request({
    headers: {'Authorization': token},
    url: '/users/bannedAccount',
    method: 'post',
    data: admin,
  })
}
export function unlock(uid) {
  return request({
    url: `/users/unlockAccount/${uid}`,
    method: 'post'
  })
}
export function deleteAdminById(id) {
  return request({
    url: `/admin/deleteAdmin/${id}`,
    method: 'get',
  })
}
